class A:
    def __init__(self, name):
        self._name = name

    @property
    def name(self):
        return self._name

    @name.setter
    def name(self, name):
        self._name = name


class B:
    def __init__(self, name):
        self._name = name

    @property
    def name(self):
        return self._name

    @name.setter
    def name(self, name):
        self._name = name


if __name__ == '__main__':
    a = A("孙悟空")
    b = B("猪八戒")


    def say_hello(obj):
        print(f"你好{obj.name}")
    say_hello(b)